﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using WorkItemAnalyser.Core.Assertions;

namespace WorkItemAnalyser.Core
{
    public class Query
    {
        private readonly string workItemType;
        private readonly string teamProjectName;

        public Query(string workItemType, string teamProjectName)
        {
            this.workItemType = workItemType;
            this.teamProjectName = teamProjectName;
        }

        public string WorkItemType
        {
            get { return workItemType; }
        }

        public string TeamProjectName
        {
            get { return teamProjectName; }
        }

        public virtual bool IsMatch(WorkItem workItem)
        {
           return  (workItem.Project.Name.Equals(teamProjectName, StringComparison.OrdinalIgnoreCase)) &&
                    (workItem.Type.Name.Equals(workItemType, StringComparison.OrdinalIgnoreCase));
        }
    }
}